import axios from 'axios'
import { ElMessage } from 'element-plus'
export const request = axios.create({
  baseURL: 'http://121.43.210.31:8080',
  timeout: 10000,
  headers: { 'Content-Type': 'application/json;charset=utf-8' }
})

request.interceptors.request.use(config => {
  return config
})

request.interceptors.response.use(response => {
  console.log(response.data)
  if(response.data.code === 200){
    ElMessage.success(response.data.message)
  }else{
    ElMessage.error(response.data.message)
  }
  return response.data
})